import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";

/**
 * 添加好友
 * @param data
 * @returns {*}
 */
export function addFriendApi(data) {
  return request({
    url: '/system/request/addFriend',
    method: 'post',
    data: data
  })
}

/**
 * 搜索用户
 * @param data
 * @returns {*}
 */
export function searchUserApi(data) {
  return request({
    url: '/system/relationship/queryUserList',
    method: 'post',
    data: data
  })
}


/**
 * 获取好友列表
 * @param data
 * @returns {*}
 */
export function getFriendListApi(data) {
  return request({
    url: '/system/relationship/queryFriendListByUserId',
    method: 'post',
    data: data
  })
}

/**
 * 获取单个好友添加记录
 * @param data
 * @returns {*}
 */
export function getOneFriendRequestApi(data) {
  return request({
    url: '/system/request/getOneFriendRequest',
    method: 'post',
    data: data
  })
}


/**
 * 获取好友申请列表
 * @param data
 * @returns {*}
 */
export function getFriendApplyListApi(data) {
  return request({
    url: '/system/request/selRequestList',
    method: 'post',
    data: data
  })
}


/**
 * 处理好友申请
 * @param data
 * @returns {*}
 */
export function handleFriendRequestApi(data) {
  return request({
    url: '/system/request/handleFriendRequest',
    method: 'post',
    data: data
  })
}


/**
 * 创建会话
 * @param data
 * @returns {*}
 */
export function createChatSessionApi(data) {
  return request({
    url: '/system/session/createChatSession',
    method: 'post',
    data: data
  })
}


/**
 * 获取用户会话
 * @param data
 * @returns {*}
 */
export function getFriendSessionListApi(data) {
  return request({
    url: '/system/session/querySessionList',
    method: 'post',
    data: data
  })
}



/**
 * 加载用户与置顶好友的消息列表
 * @param data
 * @returns {*}
 */
export function loadCurMessageApi(data) {
  return request({
    url: '/system/message/queryCacheMsgList',
    method: 'post',
    data: data
  })
}


/**
 * 设置当前用户会话选中信息
 * @param data
 * @returns {*}
 */
export function setSessionSelectedStatusApi(data) {
  return request({
    url: '/system/session/setSessionSelectedStatus',
    method: 'post',
    data: data
  })
}



/**
 * 更新未读消息数
 * @param data
 * @returns {*}
 */
export function updateSessionVOInfoApi(data) {
  return request({
    url: '/system/session/updateSessionVOInfo',
    method: 'post',
    data: data
  })
}


/**
 * 更新未读消息数
 * @param data
 * @returns {*}
 */
export function setMessageReadApi(data) {
  return request({
    url: '/system/message/setMessageRead',
    method: 'post',
    data: data
  })
}


/**
 * 当消息是未读的时候  设置redis缓存中的未读消息数
 * @param data
 * @returns {*}
 */
export function updateRedisUnReadInfoApi(data) {
  return request({
    url: '/system/message/updateRedisUnReadInfo',
    method: 'post',
    data: data
  })
}
